export interface UserInfo {
  id: number
  username: string
  nickname: string
  avatar: string
  email: string
  phone: string
  status: string
  roles: string[]
  permissions: string[]
  menus: RouteMenu[]
}

export interface ApiResponse<T = any> {
  code: number
  data: T
  message: string
}

export interface RouteMenu {
  id: number
  parentId: number
  title: string
  path: string
  component: string
  type: number
  permission: string
  icon: string
  sort: number
  status: string
  children?: RouteMenu[]
}

export interface PageParams {
  pageNum: number
  pageSize: number
}

export interface PageResult<T> {
  records: never[]
  list: T[]
  total: number
}

export interface LoginParams {
  username: string
  password: string
}

export interface Role {
  id: number
  name: string
  code: string
  sort: number
  status: '0' | '1'
  remark: string
  createTime: string
}

export interface Menu {
  id: number
  parentId: number
  type: 0 | 1 | 2
  title: string
  path: string
  component: string
  permission: string
  icon: string
  sort: number
  status: '0' | '1'
  children?: Menu[]
}

export interface FormConfig {
  labelWidth?: string | number
  labelPosition?: 'left' | 'right' | 'top'
  size?: 'large' | 'default' | 'small'
}

export interface TableColumn {
  prop: string
  label: string
  width?: number | string
  minWidth?: number | string
  fixed?: boolean | 'left' | 'right'
  sortable?: boolean
  align?: 'left' | 'center' | 'right'
  formatter?: (row: any, column: TableColumn) => string | number
  show?: boolean
}

export interface CrudOptions<T = any, Q = any> {
  listApi: (params: Q) => Promise<ApiResponse<PageResult<T>>>
  addApi: (data: T) => Promise<ApiResponse>
  updateApi: (data: T) => Promise<ApiResponse>
  deleteApi: (id: number) => Promise<ApiResponse>
  batchDeleteApi: (ids: number[]) => Promise<ApiResponse>
  formRules?: Record<string, any[]>
  defaultForm: Partial<T>
} 